package edu.uwlax.cs.oayonlinestore.client.utils;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Widget;

public class SwitchPage extends DefaultAsyncCallback implements ClickListener , Command{
	
	private String anchor;

	public SwitchPage(StackPage p) {
		super();
		this.anchor = p.getAnchor();
	}
	
	public SwitchPage(String anchor) {
		super();
		this.anchor = anchor;
	}

	public void execute() {
		History.newItem(anchor);
	}

	public void onClick(Widget sender) {
		execute();
	}

	public void onSuccess(Object arg0) {
		execute();
	}

}
